<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/css/admin/main.css"/>
    <link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/resources/css/ztree/metroStyle/metroStyle.css"/>
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/ztree/jquery.ztree.core.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/ztree/jquery.ztree.excheck.min.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/core/jquery.cms.core.js"></script>
    <script type="text/javascript" src="<%=request.getContextPath() %>/resources/js/admin/main.js"></script>
    <script type="text/javascript">
        $(function () {
            var t = $("#tree").mytree({url:$("#treePath").val(),
                mine:{listChild:0},
                callback:{
                    onAsyncSuccess:initTree,
                    onCheck:function(event,treeId,treeNode) {
                        alert(t.getNodes());
                    }
                },
                check:{
                    enable:true
                }
            });

            function initTree() {
                t.expandAll(true);
                var cids = $("input[name='cids']");
                for(var i=0;i<cids.length;i++) {
                    var cid = cids[i].value;
                    var n = t.getNodeByParam("id",cid,null);
                    t.checkNode(n,true,true);
                }
            }
        });
    </script>
</head>
<body>
<div id="content">
    <h3 class="admin_link_bar">
        <jsp:include page="inc.jsp"></jsp:include>
    </h3>
    <div>
        <c:forEach items="${cids}" var="cid">
            <input type="hidden" name="cids" value="${cid}"/>
        </c:forEach>
        <input type="hidden" id="treePath" value="<%=request.getContextPath() %>/admin/channel/treeAll"/>
        <div style="padding-left:10px;font-size:12px;">当前组名称:${group.name}</div>
        <div id="tree" class="ztree">

        </div>
    </div>

</div>
</body>
</html>